﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.Generic;
using Core.DataAccess.Interfaces;
using Core.DataAccess.Tools.Interfaces;
using Core.Model;

namespace Core.DataAccess.Implementations
{
    public class TagDataProvider:ModelDataProvider<Tag>, ITagDataProvider
    {
        public TagDataProvider(IConversation conversation, IRepository<Tag> repository) : base(conversation, repository)
        {
        }

        #region Implementation of ITagDataProvider

        public Tag GetTagByName(string tagName)
        {
            Conversation.Resume();
            var criteria = Conversation.Session.QueryOver<Tag>().Where(x =>
                x.TagTitle == tagName).SingleOrDefault<Tag>();
            Conversation.Pause();
            return criteria;
        }

        #endregion
    }
}
